<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Gentelella Alela! | </title>

    <!-- Bootstrap -->
    <link href="/resources/gentelella/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="/resources/gentelella/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="/resources/gentelella/vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="/resources/gentelella/vendors/iCheck/skins/flat/green.css" rel="stylesheet">

    <!-- bootstrap-progressbar -->
    <link href="/resources/gentelella/vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- JQVMap -->
    <link href="/resources/gentelella/vendors/jqvmap/dist/jqvmap.min.css" rel="stylesheet"/>
    <!-- bootstrap-daterangepicker -->
    <link href="/resources/gentelella/vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="/resources/gentelella/css/custom.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/resources/datatables/dataTables.bootstrap.css?v=2">
    <link href="/resources/gentelella/vendors/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
    <link href="/resources/paginator/css/bootstrap-combined.min.css" rel="stylesheet">
    <link href="/resources/css/self.css" rel="stylesheet">
    <!-- table -->
    <script src="/resources/js/jquery-1.11.1.min.js"></script>
    <script src="/resources/datatables/jquery.dataTables.min.js"></script>
    <script src="/resources/datatables/dataTables.bootstrap.min.js"></script>
    <script src="/resources/paginator/js/bootstrap-paginator.js"></script>
    <script src="/resources/js/self.js"></script>
    <style type="text/css">
        .form-data{
            width: 150px !important;
        }
    </style>
</head>

<body>
<div class="col-md-12">
    <div class="box-body" style="padding-bottom:10px;">
        <div class="row form-inline" style="margin-left: 20px;">
            <div class="form-group">
                <label>企业:</label>
                <select name="companyId" id="companyId" class="form-control form-data">
                    <option value="">全部</option>
                </select>

            </div>
            <div class="form-group">
                <input type="hidden" class="form-control form-data" name="process"/>
                <label>领用人:</label>
                <input type="text" class="form-control form-data" name="supplierEmployee"/>
            </div>

            <button type="button"  onclick="searchData()" class="btn btn-primary">查询</button>



        </div>
    </div>
    <div class="x_panel">

        <table id="example" class="table table-bordered table-striped dataTable" cellspacing="0" width="100%">
            <thead>
            <!--<tr>-->
                <!--<th rowspan="2" colspan="1">日期</th>-->
                <!--<th colspan="4" rowspan="1" style="text-align: center">入库</th>-->
                <!--<th colspan="4" rowspan="1" style="text-align: center">出库</th>-->
                <!--<th  rowspan="2" colspan="1">库存</th>-->
            <!--</tr>-->
            <tr>
                <th>序号</th>
                <th>品类</th>
                <th>出库日期</th>
                <th>领用人</th>
                <th>数量</th>
                <th>单位</th>
                <th>值班领导</th>
                <th>剩余库存</th>
            </tr>
            </thead>
        </table>
        <div id="example_page">
        </div>
    </div>
</div>


</body>
<script type="text/javascript">
    //列名称
//    var columns = ["","supplierOrderName","amount","unit","supplierEmployee","zbEmployee","use","kc","telephone", "createTime", "id"];
    var columns=["","materialName","createTime","supplierEmployee","amount","unit","zbEmployee","kc"];
    // var columns = ["createTime","supplierIntoWarehouseWarpper.companyName",
    //     "supplierIntoWarehouseWarpper.transportCompanyName",
    //     "supplierIntoWarehouseWarpper.supplierEmployee",
    //     "supplierIntoWarehouseWarpper.amount",
    //     "supplierEmployee","zbEmployee","amount","use", "kc"/*, "id"*/];
    var createdCellFun = function (td, cellData, rowData, row, col) {
        /* $(td).css('color', 'red');*/

        switch (col){
            case 0 :
                $(td).html((row+1));
                break;
            case 2:
                $(td).html(new Date(cellData).format("yyyy-MM-dd hh:mm:ss"));
                break;

            /* case 12:
             $(td).html(new Date(cellData).format("yyyy-MM-dd"));
             break;*/
          /*  case 12:
                var html = "";
                html += "<a href='javascript:void(0);' onclick='edit(\""+cellData+"\")' >修改</a>&nbsp;&nbsp;&nbsp;&nbsp;";
                $(td).html(html);
                break;*/
        }
    }
    $(function () {
        setTitle("采购单>出库");
        buildSelect("/admin/company/listAll.do","#companyId","id","name",{});
        buildPage("#example");
        var param = getParam();
        initDataTable("#example", "/admin/supplierOutWarehouse/list.do",param,columns,createdCellFun);
    });
    function getParam(){
        var param = getPageDataByClass("form-data");
        param['page']= 1;
        param['size']= 10;
        return param;
    }
    function buildPage(element) {
        var param = getParam();
        //点击分页页面按钮
        var clickFun = function (e, originalEvent, type, page) {
            //构建查询参数
            param = getParam();
            param['size'] = 10;
            _page = page;
            param['page'] = page;
            initDataTable("#example", "/admin/supplierOutWarehouse/list.do", param, columns, createdCellFun);
        }
        $.ajax({
            url:"/admin/supplierOutWarehouse/count.do?_t=" + new Date().getTime(),
            data: param ,
            type:'post',
            dataType:"json",  //xml  html   script  jsonp
            success:function(result){
                initPage($("#example_page"),1,result.data,clickFun);
            }
        });
    }
    function searchData() {
        var param = getParam();
        initDataTable("#example", "/admin/supplierOutWarehouse/list.do", param, columns, createdCellFun);
        buildPage("#example");
    }
    function add() {
        goto("supplier_out_warehouse_edit.html",{"back_url":"supplier_out_warehouse_list.html"});
    }
    function edit(id) {
        goto("supplier_out_warehouse_edit.html",{"id":id,"back_url":"supplier_out_warehouse_list.html"});
    }

</script>
</html>